<?php 
class XMLHelper{
   var $xmlString;
   function XMLHelper($xmlString){
       $this->xmlString = $xmlString;
   }

   function getXMLNodeValue($xmlNodeParam,$isUrl){
	   $xmlNode = "&lt;".$xmlNodeParam."&gt;";
	   if(!$isUrl)
		$xmlStringChars = str_replace("/","",$this->xmlString);
	   else
		$xmlStringChars = $this->xmlString;
	   $dealXML = strchr($xmlStringChars,$xmlNode);
	   $xmlNodeLength = strlen($xmlNode);
	   $dealXML2 = substr($dealXML,$xmlNodeLength); 
	   if(!$isUrl){
			return substr($dealXML2,0,strpos($dealXML2,$xmlNode));
	   }else{
			return substr($dealXML2,0,strpos($dealXML2,$xmlNodeParam."&gt;")-5);
	   }
   }
   function getXMLNodeDulpValue($oldxml,$xmlNodeParam,$isUrl){
	   $xmlNode = "&lt;".$xmlNodeParam."&gt;";
	   if(!$isUrl)
		$xmlStringChars = str_replace("/","",$oldxml);
	   else
		$xmlStringChars = $oldxml;
	   $dealXML = strchr($xmlStringChars,$xmlNode);
	   if(strlen($dealXML) == 0) return "";
	   $xmlNodeLength = strlen($xmlNode);
	   return str_replace($dealXML,"",$xmlStringChars);
	  //if(!$isUrl){
			//return substr($xmlStringChars,0,strlen($xmlStringChars)-$xmlNodeLength);
	  // }else{
			//return substr($xmlStringChars,0,strlen($xmlStringChars)-$xmlNodeLength-5);
	   //}
   }


   function getXMLDuilpNodeValue($xmlNodeParam){
       $xmlNode = "&lt;".$xmlNodeParam."&gt;";
	   $xmlNodeSingle = $xmlNodeParam."&gt;";
	   //$xmlStringChars = str_replace("/","",$this->xmlString);
	   $xmlNodeParamArray = split($xmlNode,$this->xmlString);
	   $xmlNodeArray = Array();
       foreach($xmlNodeParamArray as $single){
		  if(split($xmlNodeSingle,$single)<=1) break;
          $xmlNodeArray[] = $single; 
	   }
	   //$xmlNodeValue = Array();
	   $xmlNodeValueString;
	   $flag = 1;
	   foreach($xmlNodeArray as $nodeSingle){
		      $temp1 = $this->getXMLNodeDulpValue($nodeSingle,$xmlNodeParam,false);
			  //$temp2 = $this->getXMLNodeDulpValue($nodeSingle,"name",false);
			  //$temp3 = $this->getXMLNodeDulpValue($nodeSingle,"headurl",true);
              //$xmlNodeValue[] = array('uid' => $temp1,'name' => $temp2,'headurl' => $temp3);
			  
			 // echo "<p/>".$nodeSingle."        ".$temp1."  hhhh<br/>";
			 if(strlen($temp1) != 0){
				$xmlNodeValueString= $xmlNodeValueString."'".$temp1."'";
				if($flag != count($xmlNodeArray)){
					$xmlNodeValueString= $xmlNodeValueString.",";
				}
			 }
	         $flag =  $flag + 1;
	   }
	   return $xmlNodeValueString;
   }

}


